package system

import (
	"github.com/google/uuid"
	"mycms/global"
)

// @title	后台管理员表
type Admin struct {
	global.Model
	Uuid     uuid.UUID `json:"uuid" gorm:"uniqueIndex:uuid;comment:用户UUID"`
	Username string    `json:"username" form:"username" binding:"required"`
	Password string    `json:"password" form:"password" binding:"required"`
	Realname string    `json:"realname" form:"realname" binding:"required" gorm:"size:15; comment:真实姓名"`
	Status   uint      `json:"status" form:"status" gorm:"type:tinyint; size:1; default:1; not null; comment:状态：1、正常，2、禁用"`
	Avatar   string    `json:"avatar" form:"avatar"`
	Phone    string    `json:"phone" form:"phone" binding:"required" gorm:"size:15; comment:手机"`
	Email    string    `json:"email" form:"email" gorm:"comment:邮箱"`
	Remark   string    `json:"remark" form:"remark" gorm:"comment:备注"`
	RoleId   string    `json:"role_id" form:"role_id" gorm:"comment:角色ID"`
}

//	自定义表名
func (Admin) TableName() string {
	//	表名
	table_name := "admins"
	return global.CONFIG.Mysql.TablePrefix+table_name
}
